﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Text;

namespace BusinessLogic
{
    public class CheckRequestedCommand : BaseCommand<object>
    {
        public CheckRequestedCommand(string vin,string dealer_code)
        {
            SetQuery("SELECT id FROM acm_tx WHERE vin=@vin and change_from_dealer_code is not null and tx_dealer_code=@tx_dealer_code");

            cmd.Parameters.AddWithValue("vin", vin);
            cmd.Parameters.AddWithValue("tx_dealer_code", dealer_code);
        }

        public override void Command()
        {
            SqlDataReader dr = cmd.ExecuteReader();

            Result = dr.HasRows;
        }
    }
}
